package com.sss.ordermodel.feignservice;

import com.sss.common.entities.Product;
import com.sss.common.responseutil.Result;
import com.sss.ordermodel.config.FeignConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author sss ,fallback =ProductServiceImpl.class
 * @date 2020-04-06 13:59
 **/
@Component
@FeignClient(name = "PRODUCT-SERVICE",configuration = FeignConfiguration.class)
public interface ProductService {


    @GetMapping("/product/list")
    Result<List<Product>> productList();

    /**
     * 修改商品
     * @return
     */
    @PutMapping("/product/{id}")
     Result<Boolean> productUpdate(@PathVariable("id") Integer id, @RequestBody Product product);

    /**
     * 查询商品详情信息
     * @return
     */
    @GetMapping("/product/{id}")
    Result<Product> getProductById(@PathVariable("id") Integer id);
}
